package com.tianqu.tms.www.system.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.www.system.controller.AucBidTypeDeleteResultController;

/**
 * @author zhangxueliang
 * 竞价模式删除结果
 */
public class AucBidTypeDeleteResultAction extends TmsAction{
	private Logger logger = Logger.getLogger(AucBidTypeDeleteResultAction.class);
	private static final String OFF = "off";
	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");
		if(!isTokenValid(request)){//如果两个值相等,即表单重复提交  
            this.saveToken(request);  
            setErrorsToRequest(request, TmsConstants.I0005 ,null);
            request.setAttribute(OFF, "");
            return mapping.findForward(TmsConstants.SUCCESS);
        }else{//当用户首次提交时返!isTokenValid()返回true  
        	 request.setAttribute(OFF, "信息删除完了");
            this.resetToken(request);//将用户session中的token清空  
        }
		AucBidTypeDeleteResultController controller = new AucBidTypeDeleteResultController();
		controller.execute(uc);
		uc.removeAttribute(TmsConstants.VIEWHELP);
		logger.debug(this.getClass().getName() + "#doAction was completed.");
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
